﻿Imports System.Drawing
Imports System.IO
Public Class Imagen : Implements IEquatable(Of Imagen)
    Private _Imagen As Image
    Private _RutaCompleta As String

    Public Property Imagen As Image
        Get

            Return Image.FromFile(_RutaCompleta)
        End Get
        Set(ByVal value As Image)
            _Imagen = value
        End Set
    End Property

    Public Property RutaCompleta As String
        Get
            Return _RutaCompleta
        End Get
        Set(ByVal value As String)
            _RutaCompleta = value
        End Set
    End Property
    Public ReadOnly Property NombreFichero As String
        Get
            Dim nombr() As String = _RutaCompleta.Split("\")
            Return nombr(nombr.Length - 1)
        End Get
    End Property

    Public ReadOnly Property NombreFoto As String
        Get
            Dim nmbr() As String = _RutaCompleta.Split("\")
            Dim nmbr2() As String = nmbr(nmbr.Length - 1).Split(".")
            Return nmbr2(nmbr.Length - 2)
        End Get
    End Property

    Public Function Equals1(other As Imagen) As Boolean Implements System.IEquatable(Of Imagen).Equals

        Return Me.RutaCompleta.ToLower = other.RutaCompleta.ToLower

    End Function

    Public Sub CargarDatosImagen(ByVal ruta As String)

        Dim nmbr() As String = ruta.Split("\")
        Me._RutaCompleta = ruta
        Me.Imagen = Image.FromFile(ruta)
    End Sub
End Class
